package cn.echoedu.control;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.echoedu.command.base.FailureParam;
import cn.echoedu.command.base.SuccessParam;
import cn.echoedu.entity.School;
import cn.echoedu.entity.SchoolNotify;
import cn.echoedu.entity.receivecommand.SchoolListReceive;
import cn.echoedu.entity.receivecommand.SchoolNotifyFirstReceive;
import cn.echoedu.util.ObjectUtil;

public class SchoolControl extends BaseControl{

	public void doQuerySchoolList(HttpServletRequest request,
			HttpServletResponse response, SchoolListReceive schoollistreceive) {
		// TODO Auto-generated method stub
	     List<School> schoollist = getSchoolModel().queryAllSchoolList();
	     if(ObjectUtil.isNull(schoollist)){
	    	 sendFailure(getFailureParam(request, response,
	    			 schoollistreceive.getCode()));
	    	 
	     }
	     else{
	    	 sendSuccess(getSuccessParam(request,response,schoollist,
	    			 schoollistreceive.getToken()
	    			 ,schoollistreceive.getCode()));
	     }
	}
	
	private void sendSuccess(SuccessParam successParam) {
		// TODO Auto-generated method stub
		getResponseService().doSchoolList(successParam);
	}
	

	private void sendFailure(FailureParam failureParam) {
		// TODO Auto-generated method stub
		getResponseService().doSchoolList(failureParam);
	}

	

}
